package com.contexticon.mediaTest;

import java.io.File;

import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextPane;
import javax.swing.SwingUtilities;

import uk.co.caprica.vlcj.binding.LibVlc;
import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent;
import uk.co.caprica.vlcj.runtime.RuntimeUtil;

import com.contexticon.Transcriber2.Transcriber5;
import com.sun.jna.NativeLibrary;


public class Tutorial2B {


  private final EmbeddedMediaPlayerComponent mediaPlayerComponent;

  public static void main(String[] args) {
	  
		File file = new File("/Applications/VLC.app/Contents/MacOS/lib/");
		if (file.exists()) {
			System.setProperty("jna.library.path",
					"/Applications/VLC.app/Contents/MacOS/lib/");

		} else {
			System.setProperty("jna.library.path",
					"C:\\Users\\Till\\Desktop\\VLC builds\\Win64\\");
		}
			
    SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
        new Tutorial2B();
      }
    });
  }
  
  private Tutorial2B() {
		//Tutorial2BTextAreaFrame TextAreaFrame = new Tutorial2BTextAreaFrame();

		JFrame frame = new JFrame("vlcj Tutorial");
    
    mediaPlayerComponent = new EmbeddedMediaPlayerComponent();

    frame.setContentPane(mediaPlayerComponent);
    
    frame.setLocation(100, 100);
    frame.setSize(1050, 600);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);

    //mediaPlayerComponent.getMediaPlayer().playMedia("C:/User/Till/Desktop/1.flv");
    
    final JFileChooser fileChooser = new JFileChooser();
	if (JFileChooser.APPROVE_OPTION == fileChooser.showOpenDialog(frame)) {
		mediaPlayerComponent.getMediaPlayer().playMedia(fileChooser.getSelectedFile().getAbsolutePath());
	}
    
    // create new frame with text area
    JFrame frame2 = new JFrame("Text Area Frame");
    
    JPanel contentPane = new JPanel();
    frame2.setContentPane(contentPane);
    frame2.setLocation(50,50);
    frame2.setSize(300, 300);
    frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame2.setVisible(true);
    
    JTextArea tArea = new JTextArea();
    //JTextPane TextPane = new JTextPane();
    //contentPane.add(TextPane);
    contentPane.add(tArea);
    //TextPane.setSize(300, 200);
    tArea.setSize(300, 300);
    
  }
}
